﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/UserMaster.master" Inherits="System.Web.Mvc.ViewPage<Eacademy.Domain.Models.AdminAssignmentListViewModel>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $(".subject a").click(function () {
                $(this).siblings(".mentors").slideToggle();
                return false;
            });
            $(".delete-Assignment-link").live("click", function (event) {
                event.preventDefault();
                var $link = $(this);
                $("#dialog-confirm").dialog({
                    resizable: false,
                    height: 120,
                    modal: true,
                    draggable: false,
                    buttons: {
                        "Continue": function () {
                            $(this).dialog("close");
                            $.post($link.attr("href"), null, reloadPage);
                        },
                        Cancel: function () {
                            $(this).dialog("close");
                        }
                    }
                });
            })
        });

        function reloadPage() { location.reload(true); }
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    View Assignments
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3> View Assignments - <span style="color:#209A06;"><%=Model.Subject.SubjectName %> </span>  <span class="backto"> <a href="/mentor/subjects" class="back">Back to List</a></span></h3>
        <input type="button" value="Add Assignment" onclick="window.open('/mentor/assignments/add/<%=Model.Subject.SubjectId%>','_self')" class="button-style"/>
    <br />
    <br />
    <%=Html.Grid(Model.AssignmentsList).Columns(column =>
      {
          column.For(x => x.Title).Sortable(true).Attributes(@class => "title");
          column.For(x => Html.ActionLink("Edit", "Edit", new { id = x.AssignmentId }));
          column.For(x => Html.ActionLink("Delete", "Delete", new { id = x.AssignmentId }, new { @class = "delete-Assignment-link" }));
          column.For(x => Html.ActionLink("View Details", "Details", new { Controller = "Assignments", id = x.AssignmentId, subid = x.SubjectId }));
      }).Sort(Model.GridSortOptions)
            .Attributes(@id => "grid-style" , cellspacing => "0",cellpadding => "0")
            .Empty("No Assignments")%>
    <div class="event-paging">
        <div class="pager">
            <% if (Model.AssignmentsList.TotalItemCount > Model.AssignmentsList.PageSize)
               {%>
            <%= Html.Pager(Model.AssignmentsList.PageSize, Model.AssignmentsList.PageNumber, Model.AssignmentsList.TotalItemCount)%>
            <%} %>
        </div>
    </div>
    <div id="dialog-confirm" title="Delete this Assignment?" style="display: none;">
        <p>
            Are you sure you want to delete this Assignment?</p>
    </div>
</asp:Content>
